﻿@using TomNet.IMSC.Model.DbModels.Common;

@{
    Layout = null;
    var entity = ViewData["entity"] as Menu;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <link href="~/Content/Css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="~/Content/Css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="~/Content/Css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="~/Content/Css/animate.css" rel="stylesheet">
    <link href="~/Content/Css/style.css?v=4.1.0" rel="stylesheet">
    <link href="~/Content/common.css" rel="stylesheet">
    <title>edit</title>
    <style>

    </style>
</head>
<body>
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <form class="form-horizontal m-t" id="mainForm">
                    <input type="hidden" id="Id" name="Id" value="@entity.Id" />
                    @*<input type="hidden" id="CreatedTime" name="CreatedTime" value="@entity.CreatedTime" />
                    <input type="hidden" id="IsLocked" name="IsLocked" value="@entity.IsLocked" />
                    <input type="hidden" id="IsDeleted" name="IsDeleted" value="@entity.IsDeleted" />*@

                    <div class="col-xs-12" style="padding:0px">
                        <div class="form-group">
                            <label class="col-xs-3 control-label">上级公司：</label>
                            <div class="col-xs-9">
                                <input id="parentName" name="parentName" type="text" class="form-control" value="@ViewData["parentName"] " disabled>
                                <input id="parent" name="ParentID" type="hidden" value="@entity.ParentID">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-3 control-label">菜单显示：</label>
                            <div class="col-xs-9">
                                <input id="Text" name="Text" type="text" class="form-control" value="@entity.Text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-3 control-label">窗口标题：</label>
                            <div class="col-xs-9">
                                <input id="Title" name="Title" type="text" class="form-control" value="@entity.Title">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-3 control-label">地址：</label>
                            <div class="col-xs-9">
                                <input id="Url" name="Url" type="text" class="form-control" value="@entity.Url">
                            </div>
                        </div>
						<div class="form-group">
							<label class="col-xs-3 control-label">所需权限：</label>
							<div class="col-xs-9">
								@Html.DropDownList("AuthorityId", (SelectList)ViewData["selectAuth"], new { @class = "form-control m-b" })
							</div>
						</div>
                    </div>

                    @*<div class="col-xs-6" style="padding:0px">
                        <div class="form-group">
                            <label class="col-xs-3 control-label">简称：</label>
                            <div class="col-xs-8">
                                <input id="shorterName" name="shorterName" type="text" class="form-control" value="@entity.ShorterName">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-3 control-label">法人代表：</label>
                            <div class="col-xs-8">
                                <input id="representativeOf" name="representativeOf" type="text" class="form-control" value="@entity.RepresentativeOf">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-3 control-label">联系电话：</label>
                            <div class="col-xs-8">
                                <input id="contactsPhone" name="contactsPhone" type="text" class="form-control" value="@entity.ContactsPhone">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-3 control-label">备注：</label>
                            <div class="col-xs-8">
                                <input id="remarks" name="remarks" type="text" class="form-control" value="@entity.Remarks">

                            </div>
                        </div>
                    </div>*@

                    <div class="form-group" style="margin-bottom:0px">
                        <div class="col-xs-3">

                        </div>
                        <div class="col-xs-8">
                            <button id="submit" class="btn btn-primary pull-right" type="submit">
                                <i class="fa fa-check"></i>&nbsp;提&nbsp;交
                            </button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <!-- 全局js -->
    <script type="text/javascript" src="~/Scripts/jquery.min.js?v=2.1.4"></script>
    <script type="text/javascript" src="~/Scripts/bootstrap.min.js?v=3.3.6"></script>

    <!-- jQuery Validation plugin javascript-->
    <script type="text/javascript" src="~/Scripts/plugins/validate/jquery.validate.min.js"></script>
    <script type="text/javascript" src="~/Scripts/plugins/validate/messages_zh.min.js"></script>
    <script type="text/javascript" src="~/Scripts/Extensions/ExtValidator.js"></script>

    <!-- layer javascript -->
    <script type="text/javascript" src="~/Scripts/plugins/layer/layer.min.js"></script>
    <script>
        $(function () {
            // validate signup form on keyup and submit
            var icon = "<i class='fa fa-times-circle'></i> ";
            var validator = $("#mainForm").validate({
                rules: {
                    Text: {
                        required: true,
                        minlength: 2
                    },
                    Title: {
                        required: true,
                        minlength: 2
                    }
                    //Url: {
                    //    required: true
                    //}
                },
                messages: {
                    Text: {
                        required: icon + "请输入菜单显示",
                        minlength: icon + "必须两个字符以上"
                    },
                    Title: {
                        required: icon + "请输入窗口标题",
                        minlength: icon + "必须两个字符以上"
                    }
                    //Url: {
                    //    required: icon + "必须输入地址"
                    //}
                },
                submitHandler: function (form) {
                    //进行ajax传值
                    $.ajax({
                        url: "/Menu/EditAsync",
                        type: "post",
                        dataType: "json",
                        data: $('#mainForm').serialize(),
                        success: function (data) {
                            //Info,Success,Warning,Error
                            var type = data.type;
                            if (type == 1) {
                                layer.msg(data.content, { icon: 6, time: 2000 },
                                    function () {
                                        var index = parent.layer.getFrameIndex(window.name);
                                        parent.layer.close(index);
                                    });

                            } else {
                                layer.msg(data.content, { icon: 5, time: 2000 });
                            }
                        }
                    });
                }
            });
        });
    </script>
</body>
</html>